package pzl.com.threadrelated.tasks;

import android.os.Looper;
import android.os.Message;
import android.util.Log;

import pzl.com.threadrelated.QuitActivity;

/**
 * @author zl.peng
 * @version [1.0, 2016-11-14]
 */
public class MyThread extends Thread {
    QuitActivity.ThreadHandler threadHandler;

    @Override
    public void run() {
        Log.e("pzl", "子线程：" + Thread.currentThread().getName() + " run() start");
        Looper.prepare();
        Looper threadLooper = Looper.myLooper();
        threadHandler = new QuitActivity.ThreadHandler(threadLooper);
        Message message = threadHandler.obtainMessage();
        message.obj = "sa bi ya";
        threadHandler.sendMessage(message);
        Looper.loop();
        Log.e("pzl", "子线程：" + Thread.currentThread().getName() + " run() end");
    }
}
